<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 一个函数有传入3个参数 ，3个参数都是数值 ，把参数组装成数组返还，数组需要是由大到小
        function bj(a, b, c) {
            function max(a, b, c) {
                var max = a;
                if (b > max) {
                    max = b;
                }
                if (c > max) {
                    max = c;
                }
                return max;
            }

            function min(a, b, c) {
                var min = a;
                if (b < min) {
                    min = b;
                }
                if (c < min) {
                    min = c;
                }
                return min;
            }

            function middle(a, b, c) {
                var middle;
                if (b < max(a, b, c) && b > min(a, b, c)) {
                    middle = b;
                }
                if (a < max(a, b, c) && a > min(a, b, c)) {
                    middle = a;
                }
                if (c < max(a, b, c) && c > min(a, b, c)) {
                    middle = c;
                }
                return middle;
            }
            return [max(a, b, c), middle(a, b, c), min(a, b, c)];
        }
        var arr1 = bj(3, 5, 4);
        console.log(arr1);
    </script>
</body>

</html>